# 初次部署后端项目到Linux服务器
ssh xxl.blue
cd /home
rm -rf shop
git clone git@gitee.com:lisailiya/shop

# 更新部署
ssh xxl.blue
cd /home/shop/shop-api
git pull -pv
export env="prod"
go mod tidy
kill $(ps -ef|grep 'shopApi'|grep -v 'grep'|awk '{print $2}') # 关闭之前启动的
# 部署实例1
go build -o shopApi1
sleep 0.2
nohup ./shopApi1 -port 8888 & # 后台启动
# 部署实例2
go build -o shopApi2
sleep 0.2
nohup ./shopApi2 -port 8889 & # 后台启动
# 部署实例3
go build -o shopApi3
sleep 0.2
nohup ./shopApi3 -port 9000 & # 后台启动
ps -ef |grep "shopApi"
echo -e "启动成功：http://xxl.blue/shop-api/ping"


# lsof -i:8888 根据端口号查询pid
